home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWToolbx / Include / FWCursor.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  3.4 KB  |  130 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWCursor.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #if !defined(FWCURSOR_H) && !defined(__ODFRC__)
  11. #define FWCURSOR_H
  12.  
  13. #ifndef FWCURSOR_K
  14. #include "FWCursor.k"
  15. #endif
  16.  
  17. #ifndef FWEXCLIB_H
  18. #include "FWExcLib.h"
  19. #endif
  20.  
  21. #ifndef FWSTDDEF_H
  22. #include "FWStdDef.h"
  23. #endif
  24.  
  25. //========================================================================================
  26. //    Forward Class Declarations
  27. //========================================================================================
  28.  
  29. class FW_PResourceFile;
  30. class FW_CCursor;
  31.  
  32. //========================================================================================
  33. //    Predefined cursors
  34. //========================================================================================
  35.  
  36. extern const FW_CCursor FW_gArrowCursor;
  37. extern const FW_CCursor FW_gIBeamCursor;
  38. extern const FW_CCursor FW_gCrossHairCursor;
  39. extern const FW_CCursor FW_gWaitCursor;
  40. extern const FW_CCursor FW_gOpenHandCursor;
  41. extern const FW_CCursor FW_gClosedHandCursor;
  42. extern const FW_CCursor FW_gSizeWECursor;
  43. extern const FW_CCursor FW_gSizeNSCursor;
  44. extern const FW_CCursor FW_gSizeNWSECursor;
  45. extern const FW_CCursor FW_gSizeNESWCursor;
  46.  
  47. //========================================================================================
  48. //    FW_CCursor
  49. //========================================================================================
  50.  
  51. class FW_CCursor
  52. {    
  53.  
  54. //----------------------------------------------------------------------------------------
  55. //    Constructor/Destructor
  56. //
  57. public:
  58.     FW_DECLARE_AUTO(FW_CCursor)
  59.  
  60.     FW_CCursor();
  61.         // Create an arrow cursor
  62.  
  63.     FW_CCursor(FW_CursorID cursorID, FW_Instance instance = NULL);
  64.         // loads a cursor
  65.         
  66.     virtual~ FW_CCursor();
  67.  
  68. //----------------------------------------------------------------------------------------
  69. //    New API
  70. //
  71. public:    
  72.     static void Show();
  73.     static void Hide();
  74.     void Select() const;
  75.  
  76.     FW_PlatformCursorHandle GetHandle() const;
  77.         // Attention (Mac Only): GetHandle will return NULL for the Arrow Cursor because the
  78.         // arrow cursor is a pointer not a handle.
  79.         
  80. protected:
  81.     void    PrivLoadCursor();
  82.         
  83. private:
  84.     FW_CCursor(const FW_CCursor& other);
  85.     FW_CCursor& operator=(const FW_CCursor& other);
  86.         // Copy constructor and assignment operator not valid for this class.    
  87.  
  88. //----------------------------------------------------------------------------------------
  89. //    New API
  90. //
  91. private:
  92.     FW_PlatformCursorHandle fCursorHandle;
  93.     
  94.     FW_Instance                fInstance;
  95.     FW_CursorID             fCursorID;
  96.     FW_Boolean                 fMacIsColor;    // Not an error: Defined even for Windows see PrivLoadCursor
  97. };
  98.  
  99. //----------------------------------------------------------------------------------------
  100. //    FW_CCursor::Show
  101. //----------------------------------------------------------------------------------------
  102. inline void FW_CCursor::Show()
  103. {
  104. #ifdef FW_BUILD_MAC
  105.     ::ShowCursor();
  106. #endif
  107.  
  108. #ifdef FW_BUILD_WIN
  109.     ::ShowCursor(TRUE);
  110. #endif
  111. }
  112.  
  113. //----------------------------------------------------------------------------------------
  114. //    FW_CCursor::Hide
  115. //----------------------------------------------------------------------------------------
  116. inline void FW_CCursor::Hide()
  117. {
  118. #ifdef FW_BUILD_MAC
  119.     ::HideCursor();
  120. #endif
  121.  
  122. #ifdef FW_BUILD_WIN
  123.     ::ShowCursor(FALSE);
  124. #endif
  125. }
  126.  
  127. #endif
  128.  
  129.  
  130.